package Day2025_02_25;

public class LeetCode1576 {
    public String modifyString(String s) {
        char[] ss = s.toCharArray();
        int n = ss.length;
        for (int i = 0; i < n; i++) {
            if (ss[i] == '?') {
                for (char j = 'a'; j < 'z'; j++) {
                    if ((i == 0 || j != ss[i - 1]) && (i == n - 1 || j != ss[i + 1])) {
                        ss[i] = j;
                        break;
                    }
                }
            }
        }
        return String.valueOf(ss);
    }
}
